
public class Principal implements Resolviendo{


	public double calcularDiscriminante(double a, double b, double c) {
		return ((b*b) - 4*a*c);
	}


	public String getRaices(double a, double b, double c) {
		if (calcularDiscriminante(a,b,c) > 0){
			return calculaRaices(a, b, c);
		}
		else if(calcularDiscriminante(a,b,c) == 0){
			double resultado = calculaUnaRaiz(a,b,c);
			String resFinal = Double.toString(resultado);
			return "x1 = x2 = "+resFinal;
		}
		else{
			return sinRaices();
		}
	}


	public String calculaRaices(double a, double b, double c) {
		double x1 = (-b + (Math.sqrt(b*b - 4*a*c)))/2;
 		double x2 = (-b - (Math.sqrt(b*b - 4*a*c)))/2;
		String x1str = Double.toString(x1);
		String x2str = (Double.toString(x2));
		return "x1= "+x1str+" x2= "+x2str;
	}

	
	public double calculaUnaRaiz(double a, double b, double c) {
		return (-b+(Math.sqrt((b*b)-4*a*c)))/2;
	}

	public String sinRaices() {
		return "La función no tiene raíces reales";
	}

	public void banner() {
		System.out.println ("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
		System.out.println ("¡Bienvenido a Quadratic Calculator!");
		System.out.println ("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
		System.out.println ("Tendremos en cuenta a la función cuadrática como:\n");
		System.out.println ("Ax**2 + Bx + C = 0\n");
		System.out.println ("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
		System.out.println ("Info. de contacto:");
		System.out.println ("Gonzalo E. Zaccardi ----> pcg.computers@hotmail.com\n\n");
		}

}
